<html><head><title>ForEach : Next</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="5">ForEach : Next</font></b></p>

<br><b>Syntax</b><blockquote><pre><font face="Courier New, Courier, mono"size="2"><b><font color="#3A3966">ForEach</font></b> <font color="#3A3966">List</font>() <b>Or</b> <font color="#3A3966">Map</font>()
  ...
<b><font color="#3A3966">Next</font></b> [List() <b>Or</b> Map()]
</font></pre></blockquote>
<b>Description</b><br><blockquote>


<b><font color="#3A3966">ForEach</font></b> loops through all elements in the specified list or map starting from the first 
element up to the last. If the list or the map is empty, <b><font color="#3A3966">ForEach</font></b> : <b><font color="#3A3966">Next</font></b> exits immediately. 
To view all commands used to manage lists, please click <a href="../list/index.html">here</a>. 
To view all commands used to manage maps, please click <a href="../map/index.html">here</a>. <br>
<br>
When used with list, it's possible to <a href="../list/deleteelement.html">delete</a> or <a href="../list/addelement.html">add</a> elements 
during the loop. As well it's allowed to change the current element with <a href="../list/changecurrentelement.html">ChangeCurrentElement()</a>. 
After one of the mentioned changes the next loop continues with the element following the current element. 
<br>
<br>
With the <a href="break_continue.html">Break</a> command its possible to exit the <b><font color="#3A3966">ForEach</font></b> : <b><font color="#3A3966">Next</font></b> loop 
at any moment, with the <a href="break_continue.html">Continue</a> command the end of the current iteration can be skipped. 

</blockquote><p><b>Example:</b> list</p><blockquote>


<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">NewList</font></b> <font color="#3A3966">Number</font>()
  
<font color="#3A3966">  AddElement</font>(<font color="#3A3966">Number</font>())
<font color="#3A3966">  Number</font>() = 10
    
<font color="#3A3966">  AddElement</font>(<font color="#3A3966">Number</font>())
<font color="#3A3966">  Number</font>() = 20
    
<font color="#3A3966">  AddElement</font>(<font color="#3A3966">Number</font>())
<font color="#3A3966">  Number</font>() = 30
    
  <b><font color="#3A3966">ForEach</font></b> <font color="#3A3966">Number</font>()
    <b><font color="#3A3966">Debug</font></b> <font color="#3A3966">Number</font>() <font color="#3A3966">; Will output 10, 20 and 30</font>
  <b><font color="#3A3966">Next</font></b>
</font></pre>

</blockquote><p><b>Example:</b> Map</p><blockquote>


<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">NewMap</font></b> <font color="#3A3966">Country</font>.s()

<font color="#3A3966">  Country</font>(&quot;US&quot;) = &quot;United States&quot;
<font color="#3A3966">  Country</font>(&quot;FR&quot;) = &quot;France&quot;
<font color="#3A3966">  Country</font>(&quot;GE&quot;) = &quot;Germany&quot;

  <b><font color="#3A3966">ForEach</font></b> <font color="#3A3966">Country</font>()
    <b><font color="#3A3966">Debug</font></b> <font color="#3A3966">Country</font>()
  <b><font color="#3A3966">Next</font></b>
</font></pre>
</body></html>